Skip to content

Conversation

@makai410
Copy link
Contributor

@makai410 makai410 commented Nov 1, 2025

cc #148266 .
follow-up of #148341 .

This fixes the issues that can be reproduced by x test compiler/rustc_public:

error: function `run` is never used
   --> compiler/rustc_public/src/compiler_interface.rs:838:15
    |
838 | pub(crate) fn run<'tcx, F, T>(interface: &CompilerInterface<'tcx>, f: F) -> Result<T, Error>
    |               ^^^
    |
    = note: `-D dead-code` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(dead_code)]`

error: unreachable `pub` item
  --> compiler/rustc_public/src/unstable/mod.rs:25:1
   |
25 | pub trait InternalCx<'tcx>: Copy + Clone {
   | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates
   = note: `-D unreachable-pub` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unreachable_pub)]`

error: unreachable `pub` item
  --> compiler/rustc_public/src/unstable/mod.rs:62:1
   |
62 | pub trait Stable<'tcx>: PointeeSized {
   | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

error: unreachable `pub` item
  --> compiler/rustc_public/src/unstable/mod.rs:81:1
   |
81 | pub trait RustcInternal {
   | ---^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

error: could not compile `rustc_public` (lib) due to 4 previous errors

@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2025

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2025

r? @celinval

rustbot has assigned @celinval.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for proactively looking at this

View changes since this review

pub mod abi;
mod alloc;
pub(crate) mod unstable;
pub mod unstable;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should make this module public. Instead, we should add an attribute to the trait declarations:

/// This is used by the public `rustc_internal::stable` function when feature `rustc_internal` is enabled.
#[cfg_attr(not(feature = "rustc_internal"), allow(unreachable_pub))]
pub trait Stable<'tcx>: PointeeSized {
  // ...
}

// A thread local variable that stores a pointer to [`CompilerInterface`].
scoped_tls::scoped_thread_local!(static TLV: Cell<*const ()>);

// FIXME(makai410): remove this cfg when we have a stable driver.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this FIXME... Maybe just a comment. We could also move this function to be inside rustc_internal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants